//
//  CZHAppNetAPIClient.m
//  GeeCityManager
//
//  Created by 聚城科技 on 16/3/9.
//  Copyright © 2016年 聚城科技. All rights reserved.
//

#import "CZHAppNetAPIClient.h"


@implementation CZHAppNetAPIClient

+ (instancetype)sharedClient {
    
    NSUserDefaults *s = [NSUserDefaults standardUserDefaults];
    NSString *AFAppDotNetAPIBaseURLString = [s valueForKey:@"URL"];
//   NSLog(@"+++++____++++%@",AFAppDotNetAPIBaseURLString);
//    if (!AFAppDotNetAPIBaseURLString) {
//        AFAppDotNetAPIBaseURLString  = @"http://0.89892528.cn:8700/";
//    }
//    NSLog(@"+++++____++++%@",AFAppDotNetAPIBaseURLString);
    static CZHAppNetAPIClient *_sharedClient = nil;
   // static dispatch_once_t onceToken;
   // dispatch_once(&onceToken, ^{
        _sharedClient = [[CZHAppNetAPIClient alloc] initWithBaseURL:[NSURL URLWithString:AFAppDotNetAPIBaseURLString]];

        //        是否通过证书验证
        _sharedClient.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
        //        接受数据类型
         _sharedClient.responseSerializer.acceptableContentTypes = [_sharedClient.responseSerializer.acceptableContentTypes setByAddingObject:@"text/plain"];
        //        数据下载完成，数据为JSON
        //_sharedClient.responseSerializer = [AFJSONResponseSerializer serializer];
        //        数据为XML
        _sharedClient.responseSerializer = [AFHTTPResponseSerializer serializer];
        //        数据为PLIST
        //        _sharedClient.responseSerializer = [AFPropertyListResponseSerializer serializer];
        //        _sharedClient.responseSerializer = [AFXMLDocumentResponseSerializer serializer];
        
        
        //        AFHTTPResponseSerializer 返回原生的数据
        //        AFJSONResponseSerializer 数组或者是字典
        //        AFXMLParserResponseSerializer  NSXMLParser对象
  //  });
    
    return _sharedClient;
}

@end

